home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5209 < prev    next >
Mailbox/MIME Entity  |  1996-08-06  |  1.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file C++ source text default
99% file C source text default
98% file C++ source, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 6c 61 6e 67 2e 63 2b | 2b 0a 50 61 74 68 3a 20 |.lang.c+|+.Path: |
|00000020| 6e 65 77 73 2e 6e 65 72 | 2e 62 62 6e 70 6c 61 6e |news.ner|.bbnplan|
|00000030| 65 74 2e 6e 65 74 21 61 | 72 63 6f 21 75 73 65 6e |et.net!a|rco!usen|
|00000040| 65 74 0a 46 72 6f 6d 3a | 20 42 72 69 61 6e 20 4c |et.From:| Brian L|
|00000050| 65 61 63 68 20 3c 6c 61 | 73 62 66 6c 3e 0a 53 75 |each <la|sbfl>.Su|
|00000060| 62 6a 65 63 74 3a 20 52 | 65 3a 20 56 69 73 69 62 |bject: R|e: Visib|
|00000070| 69 6c 69 74 79 20 52 65 | 73 74 72 69 63 74 65 64 |ility Re|stricted|
|00000080| 20 74 6f 20 43 6f 6d 70 | 69 6c 65 72 0a 58 2d 4e | to Comp|iler.X-N|
|00000090| 6e 74 70 2d 50 6f 73 74 | 69 6e 67 2d 48 6f 73 74 |ntp-Post|ing-Host|
|000000a0| 3a 20 31 33 36 2e 32 32 | 36 2e 31 31 36 2e 31 0a |: 136.22|6.116.1.|
|000000b0| 43 6f 6e 74 65 6e 74 2d | 54 79 70 65 3a 20 74 65 |Content-|Type: te|
|000000c0| 78 74 2f 70 6c 61 69 6e | 3b 20 63 68 61 72 73 65 |xt/plain|; charse|
|000000d0| 74 3d 75 73 2d 61 73 63 | 69 69 0a 4d 65 73 73 61 |t=us-asc|ii.Messa|
|000000e0| 67 65 2d 49 44 3a 20 3c | 44 4d 36 31 44 39 2e 43 |ge-ID: <|DM61D9.C|
|000000f0| 4c 4a 40 6e 65 77 73 2e | 61 72 63 6f 2e 63 6f 6d |LJ@news.|arco.com|
|00000100| 3e 0a 54 6f 3a 20 73 6a | 6d 63 63 61 75 67 40 70 |>.To: sj|mccaug@p|
|00000110| 72 61 69 72 69 65 6e 65 | 74 2e 6f 72 67 0a 53 65 |rairiene|t.org.Se|
|00000120| 6e 64 65 72 3a 20 75 73 | 65 6e 65 74 40 6e 65 77 |nder: us|enet@new|
|00000130| 73 2e 61 72 63 6f 2e 63 | 6f 6d 0a 43 6f 6e 74 65 |s.arco.c|om.Conte|
|00000140| 6e 74 2d 54 72 61 6e 73 | 66 65 72 2d 45 6e 63 6f |nt-Trans|fer-Enco|
|00000150| 64 69 6e 67 3a 20 37 62 | 69 74 0a 4f 72 67 61 6e |ding: 7b|it.Organ|
|00000160| 69 7a 61 74 69 6f 6e 3a | 20 41 52 43 4f 20 4f 69 |ization:| ARCO Oi|
|00000170| 6c 20 25 20 47 61 73 20 | 43 6f 6d 70 61 6e 79 0a |l % Gas |Company.|
|00000180| 52 65 66 65 72 65 6e 63 | 65 73 3a 20 3c 34 65 71 |Referenc|es: <4eq|
|00000190| 38 74 64 24 68 70 75 40 | 76 69 78 65 6e 2e 63 73 |8td$hpu@|vixen.cs|
|000001a0| 6f 2e 75 69 75 63 2e 65 | 64 75 3e 0a 4d 69 6d 65 |o.uiuc.e|du>.Mime|
|000001b0| 2d 56 65 72 73 69 6f 6e | 3a 20 31 2e 30 0a 44 61 |-Version|: 1.0.Da|
|000001c0| 74 65 3a 20 46 72 69 2c | 20 32 20 46 65 62 20 31 |te: Fri,| 2 Feb 1|
|000001d0| 39 39 36 20 32 30 3a 33 | 39 3a 30 38 20 47 4d 54 |996 20:3|9:08 GMT|
|000001e0| 0a 58 2d 4d 61 69 6c 65 | 72 3a 20 4d 6f 7a 69 6c |.X-Maile|r: Mozil|
|000001f0| 6c 61 20 31 2e 31 32 20 | 28 58 31 31 3b 20 49 3b |la 1.12 |(X11; I;|
|00000200| 20 48 50 2d 55 58 20 41 | 2e 30 39 2e 30 35 20 39 | HP-UX A|.09.05 9|
|00000210| 30 30 30 2f 37 35 35 29 | 0a 58 2d 55 72 6c 3a 20 |000/755)|.X-Url: |
|00000220| 6e 65 77 73 3a 34 65 71 | 38 74 64 24 68 70 75 40 |news:4eq|8td$hpu@|
|00000230| 76 69 78 65 6e 2e 63 73 | 6f 2e 75 69 75 63 2e 65 |vixen.cs|o.uiuc.e|
|00000240| 64 75 0a 0a 73 6a 6d 63 | 63 61 75 67 40 70 72 61 |du..sjmc|caug@pra|
|00000250| 69 72 69 65 6e 65 74 2e | 6f 72 67 20 28 53 63 6f |irienet.|org (Sco|
|00000260| 74 74 20 4a 2e 20 4d 63 | 43 61 75 67 68 72 69 6e |tt J. Mc|Caughrin|
|00000270| 29 20 77 72 6f 74 65 3a | 0a 3e 0a 3e 20 49 73 20 |) wrote:|.>.> Is |
|00000280| 61 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 20 73 74 |a constr|uctor st|
|00000290| 69 6c 6c 20 76 69 73 69 | 62 69 6c 65 20 74 6f 20 |ill visi|bile to |
|000002a0| 61 20 43 2b 2b 20 63 6f | 6d 70 69 6c 65 72 20 69 |a C++ co|mpiler i|
|000002b0| 66 20 69 74 20 69 73 20 | 70 72 69 76 61 74 65 3f |f it is |private?|
|000002c0| 20 49 0a 3e 20 77 61 6e | 74 20 61 20 63 6f 6e 73 | I.> wan|t a cons|
|000002d0| 74 72 75 63 74 6f 72 20 | 69 6e 76 6f 6b 65 64 20 |tructor |invoked |
|000002e0| 6f 6e 6c 79 20 62 79 20 | 63 6f 6d 70 69 6c 65 72 |only by |compiler|
|000002f0| 2c 20 61 6e 64 20 6e 6f | 74 20 65 2e 67 2e 20 62 |, and no|t e.g. b|
|00000300| 79 20 73 6f 6d 65 0a 3e | 20 75 73 65 72 2d 64 65 |y some.>| user-de|
|00000310| 66 69 6e 65 64 20 27 6e | 65 77 27 2e 0a 3e 0a 3e |fined 'n|ew'..>.>|
|00000320| 20 54 68 61 6e 6b 73 2e | 0a 3e 0a 0a 0a 43 68 65 | Thanks.|.>...Che|
|00000330| 63 6b 20 6f 75 74 20 74 | 68 65 20 43 2b 2b 20 46 |ck out t|he C++ F|
|00000340| 41 51 2e 20 4d 61 6b 65 | 20 61 6c 6c 20 6f 66 20 |AQ. Make| all of |
|00000350| 79 6f 75 72 20 63 6f 6e | 74 73 74 72 75 63 74 6f |your con|tstructo|
|00000360| 72 73 20 70 72 69 76 61 | 74 65 20 61 6e 64 20 63 |rs priva|te and c|
|00000370| 72 65 61 74 65 20 61 0a | 76 69 72 74 75 61 6c 20 |reate a.|virtual |
|00000380| 63 6f 6e 73 74 72 75 63 | 74 6f 72 2e 20 65 78 3a |construc|tor. ex:|
|00000390| 0a 0a 23 69 6e 63 6c 75 | 64 65 20 3c 69 6f 73 74 |..#inclu|de <iost|
|000003a0| 72 65 61 6d 2e 68 3e 0a | 0a 63 6c 61 73 73 20 41 |ream.h>.|.class A|
|000003b0| 20 7b 0a 70 72 69 76 61 | 74 65 3a 0a 20 20 20 69 | {.priva|te:. i|
|000003c0| 6e 74 20 69 5f 3b 0a 20 | 20 20 41 28 29 20 3a 20 |nt i_;. | A() : |
|000003d0| 69 5f 28 30 29 20 7b 20 | 63 65 72 72 20 3c 3c 20 |i_(0) { |cerr << |
|000003e0| 2a 74 68 69 73 20 3b 7d | 0a 20 20 20 41 28 69 6e |*this ;}|. A(in|
|000003f0| 74 20 69 29 20 3a 20 69 | 5f 28 69 29 20 7b 20 63 |t i) : i|_(i) { c|
|00000400| 65 72 72 20 3c 3c 20 2a | 74 68 69 73 20 3b 7d 0a |err << *|this ;}.|
|00000410| 20 20 20 66 72 69 65 6e | 64 20 6f 73 74 72 65 61 | frien|d ostrea|
|00000420| 6d 26 20 20 6f 70 65 72 | 61 74 6f 72 3c 3c 28 6f |m& oper|ator<<(o|
|00000430| 73 74 72 65 61 6d 26 20 | 6f 73 74 72 2c 20 63 6f |stream& |ostr, co|
|00000440| 6e 73 74 20 41 26 20 61 | 29 0a 20 20 20 20 20 20 |nst A& a|). |
|00000450| 7b 0a 09 20 6f 73 74 72 | 20 3c 3c 20 22 41 20 68 |{.. ostr| << "A h|
|00000460| 61 73 20 74 68 65 20 76 | 61 6c 75 65 20 6f 66 20 |as the v|alue of |
|00000470| 22 20 3c 3c 20 61 2e 69 | 5f 20 3c 3c 20 65 6e 64 |" << a.i|_ << end|
|00000480| 6c 3b 0a 09 20 72 65 74 | 75 72 6e 20 6f 73 74 72 |l;.. ret|urn ostr|
|00000490| 3b 0a 20 20 20 20 20 20 | 7d 0a 70 75 62 6c 69 63 |;. |}.public|
|000004a0| 3a 0a 20 20 20 41 28 63 | 6f 6e 73 74 20 41 26 20 |:. A(c|onst A& |
|000004b0| 61 29 3a 20 69 5f 28 61 | 2e 69 5f 29 20 7b 20 63 |a): i_(a|.i_) { c|
|000004c0| 65 72 72 20 3c 3c 20 2a | 74 68 69 73 20 3b 7d 0a |err << *|this ;}.|
|000004d0| 20 20 20 73 74 61 74 69 | 63 20 41 20 67 69 6d 6d | stati|c A gimm|
|000004e0| 65 41 6e 41 28 69 6e 74 | 20 69 3d 30 20 29 20 7b |eAnA(int| i=0 ) {|
|000004f0| 20 72 65 74 75 72 6e 20 | 41 28 69 29 3b 20 7d 0a | return |A(i); }.|
|00000500| 7d 3b 0a 0a 69 6e 74 20 | 6d 61 69 6e 20 28 20 29 |};..int |main ( )|
|00000510| 0a 7b 0a 20 20 20 41 20 | 61 20 3d 20 41 3a 3a 67 |.{. A |a = A::g|
|00000520| 69 6d 6d 65 41 6e 41 28 | 33 29 3b 09 2f 2f 20 6f |immeAnA(|3);.// o|
|00000530| 6b 0a 20 20 20 41 20 2a | 61 61 20 3d 20 6e 65 77 |k. A *|aa = new|
|00000540| 20 41 3b 09 09 2f 2f 20 | 64 6f 65 73 6e 27 74 20 | A;..// |doesn't |
|00000550| 77 6f 72 6b 0a 20 20 20 | 41 20 62 20 3d 20 61 3b |work. |A b = a;|
|00000560| 09 09 09 2f 2f 20 6f 6b | 20 28 62 65 68 61 76 69 |...// ok| (behavi|
|00000570| 6f 75 72 20 63 61 6e 20 | 62 65 20 63 68 61 6e 67 |our can |be chang|
|00000580| 65 64 20 62 79 20 6d 6f | 76 69 6e 67 0a 20 20 20 |ed by mo|ving. |
|00000590| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000005a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|000005b0| 41 28 63 6f 6e 73 74 20 | 41 26 29 20 74 6f 20 70 |A(const |A&) to p|
|000005c0| 72 69 76 61 74 65 0a 20 | 20 20 20 20 20 0a 7d 0a |rivate. | .}.|
|000005d0| 0a 2d 42 72 69 61 6e 20 | 3a 2d 29 0a 0a |.-Brian |:-).. |
+--------+-------------------------+-------------------------+--------+--------+